<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var number=prompt("一共有几只猴子：");
    var kick=prompt("踢出第几只猴子：");
    var monkey=[];
    for (var i=1;i<=number;i++){
        monkey.push(i);
    }
 for(var i=1;monkey.length>1;i++){
     head=monkey.shift();
        if(i%kick!=0){
            monkey.push(head);
        }
    }
    document.write("猴王编号："+monkey[0]);
</script>
</body>
</html>